//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.goldhuman.Common.Security;

import com.goldhuman.Common.Octets;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.util.HashMap;

public abstract class Security implements Cloneable {
    private static final HashMap<String, Security> map = new HashMap();
    private int type;

    static {
        try {
            SAXParser sap = SAXParserFactory.newInstance().newSAXParser();
            sap.parse(Security.class.getResource("/config.xml").openStream(), new DefaultHandler() {
                private boolean parsing = false;

                public void startElement(String uri, String localName, String qName, Attributes attributes) {
                    if (qName.compareTo("security") == 0) {
                        this.parsing = true;
                    }

                    if (this.parsing && qName.compareTo("entity") == 0) {
                        try {
                            String cname = attributes.getValue("class").trim();
                            String name = attributes.getValue("name").trim().toUpperCase();
                            String type = attributes.getValue("type").trim();
                            Security instance = (Security)Class.forName(cname).newInstance();
                            instance.type = Integer.parseInt(type);
                            Security.map.put(name, instance);
                            Security.map.put(type, instance);
                        } catch (Exception var9) {
                            var9.printStackTrace();
                        }
                    }

                }

                public void endElement(String uri, String localName, String qName) {
                    if (qName.compareTo("security") == 0) {
                        this.parsing = false;
                    }

                }
            });
        } catch (Exception var1) {
            var1.printStackTrace();
        }

    }

    public Security() {
    }

    public void SetParameter(Octets o) {
    }

    public void GetParameter(Octets o) {
    }

    public Octets Update(Octets o) {
        return o;
    }

    public Octets Final(Octets o) {
        return o;
    }

    public Object clone() {
        try {
            return super.clone();
        } catch (Exception var2) {
            return null;
        }
    }

    public static Security Create(String name) {
        Security stub = (Security)map.get(name.toUpperCase());
        return (Security)(stub == null ? new NullSecurity() : (Security)stub.clone());
    }

    public static Security Create(int type) {
        return Create(Integer.toString(type));
    }
}
